Configurable flat file data mapping to a database

ABSTRACT

Disclosed are a method and framework for mapping data from a data source to a data destination. The method comprises the step of providing a plurality of components for performing defined functions to map the data from the source to the destination. These plurality of components perform the steps of (i) reading data from the source, (ii) processing the read data according to a set of rules, and (iii) loading the processed data into the destination. Preferably the plurality of components perform the further steps of (iv) verifying the integrity of the read data, and (v) logging results into a file. Each of the components operates independently of the other of the components.

CROSS REFERENCE TO RELATED APPLICATION

The present application is a continuation application of co-pending U.S.patent application Ser. No. 10/688,574, filed Oct. 17, 2003.

BACKGROUND OF THE INVENTION

1. Field of the Invention

This invention generally relates to data mapping, and more specifically,the invention relates to mapping data from an input file to a database.

2. Background Art

Computer applications are being used more and more. Today, particularlywith the widespread availability of the Internet, businesses are able tomake an ever increasing number of applications available worldwidetwenty-four hours a day, seven days a week for use by customers,employees and suppliers. This presents important opportunities andchallenges for businesses.

One challenge is to design the applications so that they can be used bydifferent users who may access or input data to the applications usingdifferent data formats or files. Another challenge is to design theapplications so that, in case users change the data formats used toinput data to the applications, or it otherwise becomes advantageous tochange the way data is input to the applications, the applications canbe readily modified to accommodate new or different data formats andfiles.

SUMMARY OF THE INVENTION

An object of this invention is to improve methods and systems formapping data from a source to a database.

Another object of the invention is to provide an extensible frameworkhaving a group of components, which can be readily modified or replaced,for handling various functions as data is mapped from a source to adatabase.

A further object of the present invention is to provide a framework,comprised of a group of independently adjustable components, to processdata from one source, validate the data, apply business rules on thedata, load the data into a database, log the results of this wholeprocedure, and send mailings to configured parties.

These and other objectives are attained with a method and framework formapping data from a data source to a data destination. The methodcomprises the step of providing a plurality of components for performingdefined functions to map the data from the source to the destination.These plurality of components perform the steps of (i) reading data fromthe source, (ii) processing the read data according to a set of rules,and (iii) loading the processed data into the destination. Preferablythe plurality of components perform the further steps of (iv) verifyingthe integrity of the read data, and (v) logging results into a file.Each of the components operates independently of the other of thecomponents.

The preferred embodiment of the invention, described in detail below,provides a framework written in the java programming language to read afile and to verify the file data by, for example, checking for countsand/or data consistencies. The framework then processes the data, whichmay involve applying various business logic classes as applicable, andthen loads the data into a database. The framework also logs the resultsinto a file, which can then be emailed.

Further benefits and advantages of the invention will become apparentfrom a consideration of the following detailed description, given withreference to the accompanying drawings, which specify and show preferredembodiments of the invention.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 schematically illustrates a processing framework in accordancewith his invention.

FIG. 2 shows a computer network system with which the present inventionmay be used.

FIG. 3 is an example of a file that may be read by the framework of FIG.1.

FIG. 4 shows an example of a formatter interface code that may be usedby the framework.

FIG. 5 provides an example of an implementer interface code that may beimplemented by the framework.

FIG. 6 shows the code for a logger feature that may be used by theframework.

DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS

With reference to FIG. 1, the preferred embodiment of the inventionprovides a framework, generally referenced at 10, for mapping data froma source, represented at 12, to a database, represented at 14; and thisframework comprises a plurality of components 16, 20, 22, 24 and 26 forperforming various functions. Component 16 is provided to read a file,and component 20 is used to verify the file data by, for example,checking for counts and/or data consistencies. Component 22 is used toprocess the data, which may involve applying various business logicclasses as applicable, component 24 is utilized for loading the datainto a database 14, and component 26 is provided to log the results intoa file, which can then be emailed.

Component 16 may utilize any suitable procedure and is provided withsuitable means to read data from a file. For example component 16 may bedesigned to read flat, or xml, files. Also, any suitable procedure maybe employed by component 20 to verify the integrity of the read data.Numerous such procedures are known in the art and can be used in thepractice of this invention.

Component 22 may apply a wide range of business rules to the data readby framework. Preferably, these rules can be created, modified ordeleted by an authorized administrator. In addition, any appropriateprocedure may be used by component 24 for loading the data into adatabase. Many specific procedures are known by those of ordinary skillin the art and can be used in component 24.

It should be noted that while the specific framework 10 represented inFIG. 1 only reads files, the framework can be extended to other sourcesof data like databases, mq series queues, etc. Also, while this specificembodiment of framework 10 only loads data into a database, theframework can be extended to other sources as well.

Preferably, each of the components 16, 20, 22, 24 and 26 operatesindependently of the other components of the framework 10. In this way,each component can be modified or replaced without affecting theoperation of the other components. Also, preferably the individualprograms of the components 16, 20, 22, 24 and 26 can be updated ormodified by authorized administrators during the use of framework 10.

Framework 10 if this invention can be used in many specific situations.For example, the framework may be used in conjunction with, and bespecifically designed to assist, some other application, which uses thedata from database 14. In addition, framework 10 may be used on or witha computer network, such as a LAN, a WAN or the Internet.

FIG. 2 shows, for example, framework 10 used in conjunction with anotherapplication 30 available via the Internet 32 at a Web site 34. Moreparticularly, FIG. 2 shows a server 36 and a plurality of clients 40,42, 44. Server 36 and clients 40, 42, 44 are connected to the Internet32, and the server is provided with application 30, which can beaccessed by clients 40, 42, 44 via the Internet Server 36 is alsoprovided with framework 10, which runs on the server to map input datafrom the clients to database 14, from where the data can be accessed byapplication 30.

FIGS. 3-6 show, as more particular examples, specific file or code thatcan be used with or on framework 10. In particular, FIG. 3 shows anexample of a file rcvd for currencies that may be read by framework 10.As mentioned above, it should be noted that while the specific framework10 represented in FIGS. 1 and 2 only reads files, the framework can beextended to other sources of data like databases, mq series queues, etc.

More specifically, framework 10 maps fixed length fields in the inputfile to a java object type pofield. This framework reads the xml file.For a particular field, the framework determines the start position, thelength, what database column the field maps to, which database tablesthe field maps to, whether the field can be updated or not, and whatkind of formatter to be applied on this field. The framework calls thejava class as defined within the <formatter> </formatter> tags. Thisjava class implements the formatter interface, defined as: packagecom.ibm.kestrel bridges. FIG. 4 shows an example of a formatterinterface code.

The interface of FIG. 4 defines one method: String format(String param).This method may be overridden by the implementations of this formatterclass. This is useful, for example, for formatting data fields. Forexample, a source system may send a date in the format of yyyymmdd, butthe database table may accept only a timestamp. By utilizing aformatter, the present invention eliminates the need for writing codefor formatting a date within the business logic classes.

Another file may be used to define an event handler. The event handlerpreferably implements the Implementer interface: —packagecom.ibm.kestral bridges. FIG. 5 shows an example of an Implementerinterface code.

The Implementer Interface of FIG. 5 refers to a Hashtable. ThisHashtable object contains a map of pofield objects and other classes,like the DBActions class that is used to manage database activity.

The framework 10 also preferably manages transactions. A transaction isstarted when the first record is read, and the transaction is committedor rolled back when the record, as defined in a record parameter, isencountered. This helps to insulate programs with which framework 10 isused from managing a transaction.

Preferably, framework 10 includes a Logger feature that can be used byimplementing the Logger interface: —package com.ibm.kestrel bridges.FIG. 6 shows, as an example, the code for a Logger feature.

Using this logger feature, an application can add various notifications,and then finally send an e-mail to a configured list of email ids. TheLogger feature of FIG. 6 supports sending mail using “TO, CC and the BCCfeatures of the mail.

While it is apparent that the invention herein disclosed is wellcalculated to fulfill the objects stated above, it will be appreciatedthat numerous modifications and embodiments may be devised by thoseskilled in the art and it is intended that the appended claims cover allsuch modifications and embodiments as fall within the true spirit andscope of the present invention.

1. A method for mapping data from a data source to a data destination,comprising the steps: providing a plurality of mapping components forperforming defined functions to map the data from the source to thedestination; using a computer server, implementing said mappingcomponents, to perform the steps of: i) reading data from the source,ii) processing the read data according to a set of rules, and iii)loading the processed data into the destination; wherein each of thecomponents operates independently of the other of the components;wherein the date destination is a database, and said step using thecomputer server includes the step of using the computer server,implementing said plurality of mapping components, to perform the stepsof: mapping fixed length fields in the data source to a pofield in thedatabase; and determining start positions that the fields map to in thedatabase by referring to Hash Table Objects which contain the mapping ofpofield objects in a DBA action class that is used to manage databaseactivity.
 2. A method according to claim 1, wherein the computer server,implementing the plurality of mapping components, performs, the furthersteps of iv) verifying the integrity of the read data, and v) loggingresults into a file.
 3. A method according to claim 2, wherein arespective one of the mapping components implements each of the steps(i)-(v).
 4. A method according to claim 1, wherein the data source is aflat file, and the data destination is a database.
 5. A method accordingto claim 1, wherein the computer server, implementing the plurality ofmapping components, performs, the further step of sending the results,by electronic mail, to a configured list of email addresses.
 6. A methodaccording to claim 1, wherein the step of processing the read dataincludes the step of formatting the read data for placement in the datadestination.
 7. A computer system for mapping data from a data source toa data destination, comprising: a computer server; a plurality ofcomponents running on the computer server for performing definedfunctions to map the data from the source to the destination, saidfunctions including (i) reading data from the source, (ii) processingthe read data according to a set of rules, and (iii) loading theprocessed data into the destination; wherein each of the componentsoperates independently of the other of the components; wherein the datadestination is a database, and said plurality of separate componentsrunning on the computer server perform the further function of: mappingfixed length fields in the data source to a pofield in the databases;and determining start positions that the fields map to in the databaseby referring to Hash Table Objects which contain the mapping of pofieldobjects in a DBA action class that is used to manage database activity.8. The computer system according to claim 7, wherein the plurality ofcomponents running on the computer server perform the further functionsof (iv) verifying the integrity of the read data, and (v) loggingresults into a file.
 9. The computer system according to claim 8,wherein a respective one of the components performs each of thefunctions (i)-(v).
 10. The computer system according to claim 7, whereinthe data source is a flat file, and the data destination is a database.11. The computer system according to claim 7, wherein the plurality ofcomponents running on the computer server perform the further functionof sending the results, by electronic mail, to a configured list ofemail addresses.
 12. The computer system according to claim 7, whereinthe function of processing the read data includes the function offormatting the read data for placement in the data destination.
 13. Aprogram storage device readable by a computer system, tangibly embodyinga program of instructions executable by the computer system to performmethod steps for mapping data from a data source to a data destination,said method steps comprising: establishing a plurality of components forperforming defined functions when executed on the computer system to mapthe data from the source to the destination, said plurality ofcomponents when executed on the computer system performing the steps ofi) reading data from the source, ii) processing the read data accordingto a set of rules, and iii) loading the processed data into thedestination, wherein each of the components operates independently ofthe other of the components; wherein the date destination is a database,and the plurality of separate components when executed on the computersystem perform the further steps of: mapping fixed length fields in thedata source to a pofield in the database; determining start positionsthat the fields map to in the database by referring to Hash TableObjects which contain the mapping of pofield objects in a DBA actionclass that is used to manage database activity.
 14. A program storagedevice according to claim 13, wherein the plurality of components whenexecuted on the computer system perform the further steps of iv)verifying the integrity of the read data, and v) logging results into afile.
 15. A program storage device according to claim 14, wherein arespective one of the components performs each of the steps (i)-(v). 16.A program storage device according to claim 13, wherein the data sourceis a flat file, and the data destination is a database.
 17. A programstorage device according to claim 13, wherein the plurality ofcomponents when executed on the computer system perform the further stepof sending the results, by electronic mail, to a configured list ofemail addresses.
 18. A program storage device according to claim 13,wherein the step of processing the read data includes the step offormatting the read data for placement in the data destination.